package com.czxy.dao;

import com.czxy.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {
    //查
    @Select("select  * from  student ")
    public List<Student> findAll();
    //查
    @Select("select  * from  student where  studentname like  #{studentname}")
    public  List<Student> findSname(@Param("studentname") String studentname);

    //加
    @Select("select  * from  student where  loginname = #{ loginname}")
    public List<Student> findLname(Student student);

    @Insert("insert into  student values (#{sid}, #{loginname}, #{studentname}, #{password}, #{gender}, #{major}, #{birth}, #{telephone}, #{hobby}, #{photo}, #{remark}) ")
    public  void  insert(Student student);

    //删
    @Delete("delete  from  student where sid  = #{sid}")
    public  void  delete(@Param("sid") String sid);


    //编
    @Select("select  * from  student where  sid = #{sid}")
    public  Student  findSId(@Param("sid") String sid);

    //编
    @Select("select  * from  student where sid  != #{sid}   &&  loginname = #{loginname}")
    public  List<Student> findRname(Student student);
    //更新数据
    @Update("update student set  loginname = #{loginname}, studentname = #{studentname}, password= #{password} ,gender = #{gender},major=#{major},birth=#{birth} , telephone=#{telephone}, hobby = #{hobby}, photo = #{photo} , remark = #{remark} where sid = #{sid}")
    public void  update(Student student);

    //查详情
    @Select("select  * from  student where  sid = #{sid}")
    public  List<Student> findGId(@Param("sid") String sid);






































}
